package com.imooc.module.reponse;

import com.imooc.module.collect.request.ParamsRequest;
import com.imooc.module.query.response.QueryDataResponse;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
@Data
public class DataResponse<T> extends Response<T>{

    private Table table;
    private Chart chart;

    /**
     * 业务id
     */
    private String businessId;


    /**
     * USER-用户维度，GROUP-群组维度， SCHOOL-空间维度
     */
    private ParamsRequest.DimensionParameter dimension;

    /**
     * 周期类型
     */
    private String periodType;

    /**
     * 日期
     */
    private Date requestDate;

    /**
     * 开始时间
     */
    private Date startTime;

    /**
     * 结束时间
     */
    private Date endTime;

    @NoArgsConstructor
    @Data
    public static class Dimension {
        private String dimension;
        private Long schoolId;
        private String groupId;
        private List<Long> userIds;

    }

    @Builder
    @Data
    public static class Table {
        /**
         * 表头指标参数
         */
        private String[] columns;
        /**
         * 业务名称（这个是执行过程查询到的）
         */
        private String businessName;
        private List<QueryDataResponse.TableData> dataList;
    }

    @Builder
    @Data
    public static class Chart {
        private List<QueryDataResponse.TableChart> dataList;
        private String patten;
        private String pgPatten;
        private Map<Long, String> styleMap;

        private Integer chartType;
    }
}
